def n = 5
buildPod(memory: "2Gi", cpu: "${n}") {
checkout scm
+ stage("Static analysis") {
+ shwrap("./ci/codestyle.sh")
+ }
stage("Core build") {
shwrap("""
# fetch tags so `git describe` gives a nice NEVRA when building the RPM
@prohibit='\<glnx_throw_errno_prefix *\(.*: ",' halt="don't add trailing : for glnx_throw_errno_prefix" \
$(_sc_search_regexp)
-sc_glnx_no_fd_close:
- @prohibit='\<glnx_fd_close int' halt="Use glnx_autofd, not glnx_fd_close" \
- $(_sc_search_regexp)
-
#SHELL=bash -x
show-vc-list-except:
@$(VC_LIST_EXCEPT)
--- /dev/null
+#!/usr/bin/env bash
+# Tests that validate structure of the source code;
+# can be run without building it.
+set -euo pipefail
+
+# Don't hard require Rust
+if command -v cargo >/dev/null; then
+echo -n "checking rustfmt... "
+for crate in $(find -iname Cargo.toml); do
+ if ! cargo fmt --manifest-path ${crate} -- --check; then
+ echo "cargo fmt failed; run: cd $(dirname ${crate}) && cargo fmt" 1>&2
+ exit 1
+ fi
+done
+echo "ok"
+fi
+
+echo -n 'grep-based static analysis... '
+patterns=(glnx_fd_close)
+for pat in "${patterns[@]}"; do
+ if git grep "${pat}" | grep -v codestyle\.sh; then
+ echo "Files matched prohibited pattern: ${pat}" 1>&2
+ exit 1
+ fi
+done
+echo ok